package com.cqcj.login.mapper;

import com.cqcj.login.pojo.Brand;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface BrandMapper {
    //查询全部品牌
    @Select("select * from tb_brand where is_deleted =1 ")
    List<Brand> selectAll();
    //查询某个商品
    @Select("select * from tb_brand where is_deleted =1 and id=#{id}")
    Brand selectById(int id);

    //新增品牌
    @Insert("insert into tb_brand (brandname,companyname,ordered,description,status) values (#{brandname},#{companyname},#{ordered},#{description},#{status})")
    int insetBrand(Brand brand);

    //修改品牌
    @Update("update tb_brand set brandname = #{brandname},companyname = #{companyname},ordered = #{ordered},description = #{description},status = #{status} where id = #{id}")
    void updateBrand(Brand brand);

    //删除品牌
    @Delete("update tb_brand set is_deleted = 0 where id = #{id}")
    void deleteBrand(int id);
}
